﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace BlakeAndMattGame
{
    class Wall
    {

        public Vector2 position;
        public Texture2D texture; //horizontal texture
        public Texture2D texture2; //vertical texture
        public bool vertical = false; 

        public Wall(Vector2 position, Texture2D texture, Texture2D texture2)
        {
            this.position = position;
            this.texture = texture;
            this.texture2 = texture2;
        }

        public void Draw(SpriteBatch spriteBatch)
        {
            if (!vertical)
                spriteBatch.Draw(texture, position, Color.White);
            else
                spriteBatch.Draw(texture2, position, Color.White);
        }

        public Rectangle BoundingBox
        {
            get
            {
                if(!vertical)
                    return new Rectangle((int)position.X, (int)position.Y, texture.Width, texture.Height);
                else
                    return new Rectangle((int)position.X, (int)position.Y, texture2.Width, texture2.Height);
            }
        }

        public Rectangle LeftBoundingBox
        {
            get
            {
                if(!vertical)
                    return new Rectangle((int)position.X - 1, (int)position.Y, texture.Width - (texture.Width - 1), texture.Height);
                else
                    return new Rectangle((int)position.X - 1, (int)position.Y, texture2.Width - (texture2.Width - 1), texture2.Height);
            }
        }

        public Rectangle RightBoundingBox
        {
            get
            {
                if (!vertical)
                    return new Rectangle((int)position.X + (texture.Width), (int)position.Y, texture.Width - (texture.Width - 1), texture.Height);
                else
                    return new Rectangle((int)position.X + (texture2.Width), (int)position.Y, texture2.Width - (texture2.Width - 1), texture2.Height);
            }
        }

    }
}
